<?php
class model_catalog extends model_version {
	public $pk = "uuid";
	public $table = "catalog";
	
	public function model_version_delete_byPk($pk, $insertLog = false, $deleteRelativeRecords = false) {
		if ($deleteRelativeRecords) {
			$exist_data = $this->get ( $pk );
			$catalog_sub_db_obj = spClass ( "model_catalog_sub" );
			$sub_catalog_list = $catalog_sub_db_obj->findAll ( array ('catalog_uuid' => $exist_data ['uuid'] ) );
			foreach ( $sub_catalog_list as $sub_catalog_data ) {
				$catalog_sub_db_obj->model_version_delete_byPk ( $sub_catalog_data [$catalog_sub_db_obj->pk], $insertLog, $deleteRelativeRecords );
			}
		}
		parent::model_version_delete_byPk ( $pk, $insertLog );
	}
	public function isDirectlyPlayVideo($catalog_uuid) {
		$catalog_data = $this->get($catalog_uuid);
		$isTrue = false;
		if ( $catalog_data ) {
			$isTrue = $catalog_data['name'] == 'IBIZA TV';
		}
		return $isTrue;
	}
}
